
<html>
<head>
<?php 
	echo $this->Html->css('style.css');
	echo $this->Html->script('jquery-1.8.3.min.js'); 
?>
<title>カメラ一覧を見る</title>

<script type="text/javascript" language="javascript">
            setInterval(function () {
                location.reload(true);
            }, 120000);

            $( document ).ready(function() {
            	//console.log( "ready!" );
            	var length = $("#length").val();
            	if(length <= 4){
					$( "div.unit" ).addClass(function( index, currentClass ) {
            			return "founit";
            			});				
            	} else {
            		$( "div.unit" ).addClass(function( index, currentClass ) {
            			return "over4unit";
            			});
            	}
            });
</script>
</head>
<body background="#000099" <?php if($click):?> style="text-align: center" <?php endif;?>>
		<input type="hidden" id="length" value="<?php echo count($data_camera)?>">
       <?php foreach ($data_camera as $key => $camera): ?>
       		<div class="unit">
	        <?php if(!$click):?>
	            <img style="cursor: pointer" id="camera"
			src="http://<?php echo $camera['Camera']['UniIp'] ?>:<?php echo $camera['Camera']['HttpPort'] ?>/cgi-bin/encoder?USER=<?php echo $camera['Camera']['UserName'] ?>&PWD=<?php echo $camera['Camera']['Password'] ?>&GET_STREAM"
			
			height="<?php echo $height ?>"
			onclick="window.open('<?php  echo $this->Html->url(array("controller" => "camera","action" => "view",$camera['Camera']['Id'],'big',1));?>','', 'scrollbars=yes,resizable=yes');" />
	        <?php else:?>
	            <img style="cursor: pointer" id="camera"
					src="http://<?php echo $camera['Camera']['UniIp'] ?>:<?php echo $camera['Camera']['HttpPort'] ?>/cgi-bin/encoder?USER=<?php echo $camera['Camera']['UserName'] ?>&PWD=<?php echo $camera['Camera']['Password'] ?>&GET_STREAM" />
	        <?php endif;?>
	        <div>
			<span style="font-size: 12px"><?php echo $camera['Customer']['CustName'] ?></span>&nbsp;&nbsp;<span style="font-size: 12px"><?php echo $camera['Building']['BuildName'] ?></span>
			&nbsp;&nbsp;<span style="font-size: 12px"><?php echo $camera['Camera']['CamName'] ?></span> &nbsp;&nbsp;<span style="font-size: 12px"><?php echo date('Y-m-d H:i') ?></span>
		</div>
		</div>
        <?php endforeach; ?>    
    </body>
</html>